package com.shangke.springbootkkyp.conller;

import com.shangke.springbootkkyp.pojo.User;
import com.shangke.springbootkkyp.serview.UserSerview;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
@Api("用户接口")
public class UserConller {
    @Autowired
    private UserSerview userSerview;

    /**
     * 注册用户
     */
    @GetMapping("/login/{phone}/{code}")
    @ApiOperation("注册用户")
    public Integer verify_code_login(@ApiParam("手机号") @PathVariable("phone") String phone,@ApiParam("手机验证码")@PathVariable("code") String code) throws Exception {
        // ps:注册用户id
        return  userSerview.verify_code_login(phone,code,"IdfaFd1pd3$idav");
    }

    /**
     * 使用id查询用户
     */
    @GetMapping("/findid")
    public User findId(@RequestParam(value = "id") @ApiParam("用户ID") Long id){
        return userSerview.findById(id);
    }


}
